package com.kfm.am.blockPool;

import java.util.concurrent.*;

public class Test {

    public static void main(String[] args) {
        BlockingQueue<String> bq = new ArrayBlockingQueue<>(1);
        ExecutorService service = new ThreadPoolExecutor(5, 5,
                50, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(5)
                );
        CookerRunnable c1 = new CookerRunnable(bq);
        CookerRunnable c2 = new CookerRunnable(bq);
        CookerRunnable c3 = new CookerRunnable(bq);
        EaterRunnable e1 = new EaterRunnable(bq);
        EaterRunnable e2 = new EaterRunnable(bq);
        service.execute(c1);
        service.execute(c2);
        service.execute(c3);
        service.execute(e1);
        service.execute(e2);
    }
}
